Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rig.simple, for breaks on single element #2

Closed
wants to merge 1 commit into from
Closed

Conversation

jonnor
Copy link
Contributor

@jonnor jonnor commented Oct 15, 2014

Fixes #1

@jonnor
Copy link
Contributor Author

jonnor commented Oct 15, 2014

@paulyoung Perhaps it should be called rig.single instead, as that is the main simplification here?

@paulyoung
Copy link
Contributor

This couples image size to breakpoint size which is something I was trying to avoid.

It makes sense to do that for a full-screen background image but in a lot of cases we're displaying an image at a fraction of the screen width.

@paulyoung
Copy link
Contributor

At first glance I'm a bit confused as to how assigning something to rig.simple is working since rig is a function...

I was anticipating the need to change the API slightly - perhaps making a CoffeeScript class called Rig which can be instantiated for the existing behavior and have class methods for convenience.

if not dimension
dimension = 'width'
if not breaks
breaks = [ 400, 800, 1600 ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be to omit default values and encourage usage to be very intentional, especially the breakpoints which are arbitrary.

For common use cases I'd rather pass these as params inside of a dedicated method. Something like:

Rig.resize = (block, config, selector, breakpoints, sizes) ->
  return Rig.simple block, config, selector, 'passthrough', {}, breakpoints, sizes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or rather, something like:

Rig.resize = (block, config, options) ->
  return Rig.simple block, config, 'passthrough', {}, options

Rig.resize block, config,
  selector: '#media'
  breakpoints: [504, 1008]
  widths: [200, 400, 800]

@paulyoung
Copy link
Contributor

Closing this in favor of 9571e0f.

@paulyoung paulyoung closed this Jan 12, 2015
@paulyoung paulyoung deleted the rig-simple branch April 16, 2015 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convenience methods
2 participants